package iss.java;

import iss.java.list.Node;

/**
 * Created by wenke on 2016/9/16.
 */

public class Main_A
{
    public static void main(String[] args) {
        // TODO: Implement a multithreaded test case against requirement A.
        Node node=new Node();
        node.setData(3);
        Thread ta = new Thread(){
            public void run() {
                for (int i=1; i<=10; i++) {
                    node.setData(i);
                    System.out.println("the " + Thread.currentThread().getName() + " has written the value "+i);
                }
            }
        };
        Thread tb = new Thread(){
            public void run(){
                for(int i=1; i<=10; i++){
                    node.setData(10+i);
                    System.out.println("the " + Thread.currentThread().getName() + " has written the value "+(10+i));
                }
            }
        };
        ta.start();
        tb.start();
        Thread oa = new Thread(){
            public void run(){
                for(int i=1; i<=10; i++){
                    System.out.println("Reading: "+node.getData());
                }
            }
        };
        oa.start();
    }
}
